#ifndef SEQIOT_ASDU_HANDLER_H
#define SEQIOT_ASDU_HANDLER_H

#include <stdbool.h>
#include <cs104_slave.h>

typedef struct _command_params {
    union {
        bool single_value;
        DoublePointValue double_value;
        StepCommandValue step_value;
        float normalized_value;
        int scaled_value;
        float float_value;
    };

    union {
        CP56Time2a cp56_time;
    };

    bool select;
    int qos;

} command_params_t;

typedef struct _command_t {
    IEC60870_5_TypeID type_id;

    void (*on_parse)(InformationObject io, command_params_t *param);

    bool (*on_execute)(void *parameter, int tag, command_params_t *param);
} command_t;

bool asdu_handler(void *parameter, IMasterConnection connection, CS101_ASDU asdu);

#endif //SEQIOT_ASDU_HANDLER_H
